<template>
  <a-result status="404" title="404" sub-title="Sorry, the page you visited does not exist.">
    <template #extra>
      <a-button type="primary" @click="toHome">
        个人中心
      </a-button>
    </template>
  </a-result>
</template>

<script>
export default {
  name: 'Exception404',
  methods: {
    toHome () {
      let a_str = ''
      function getPath(a_list){
        console.log(a_list,a_str)
        for(let i = 0; i < a_list.length; i++){
          let it = a_list[i]
          if(it.children && it.children.length && !a_str){
            getPath(it.children, a_str)
          }
          if(!a_str){
            console.log(1111111, it.path)
            a_str = it.path
            break
          }else{
            break
          }
        }
      }
      console.log(this.$store.getters.addRouters)
      let str = ''
      getPath(this.$store.getters.addRouters)
      this.$router.push({ path: a_str })
    }
  }
}
</script>
